package com.doodod.common.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 *
 * 根据context可以获得bean.
 * User: 孟波
 * Date: 14-01-20
 * Time: 下午8:05
 * To change this template use File | Settings | File Templates.
 *
 * always ok
 */
public class MyApplicationContextUtil implements ApplicationContextAware {
    private static ApplicationContext context;

    /**
     * spring自动注入applicationContext
     *
     * @param applicationContext
     *
     * @throws
     */
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context=applicationContext;
    }

    public static ApplicationContext getContext(){
        return context;
    }

}
